ImagXpress 13 for ActiveX - User Guide > How To > View an Image > Display Image |
To display an image:
When Notify is true, a Notify event occurs every time the control paints. There are many factors that can cause a control to paint which may not always be apparent. This can sometimes lead to unexpected results, such as infinite loops. |
The following VB code illustrates how a recursive loop can occur and potentially cause a stack overflow error:
VB Example |
Copy Code
|
---|---|
' The wrong way to do it Sub ImagXpress1_Notify() ' Changing the border causes a repaint which generates another Notify event ImagXpress1.BorderType = 1 ' Changing the filename causes a repaint which generates another Notify event ImagXpress1.FileName = "C:\PIC1.BMP" DoEvents End Sub |
You can prevent loops like this from occuring by either setting the Notify property to False to prevent a Notify event from occurring, or setting the ViewUpdate property to False to also prevent the control from repainting. |
The frequency of painting to the ImagXpress® control window is determined by the settings in Windows. If a paint is required immediately, the Paint method forces an immediate paint of the control window. The PaintDC method forces an immediate paint to a specified device (monitor or printer). Call DIBUpdate method to update the control's display with the current DIB. |
To change the image being displayed, assign ViewImageID to a different image buffer. This image displays when the control window next paints. When an image loads into ImagXpress, the ViewImageID is assigned to the newly loaded image and the image is displayed automatically. The ViewStatus property indicates the status (for example, opened, decoded, wait, saved, etc.) of the image in the ViewImageID buffer.
Each ImagXpress control that loads can display a different image, so loading multiple controls enables display of multiple images. The ManagePalette property specifies how palettes are applied across multiple control windows. When ManagePalette is True, the palette of the image displays in the top (z-level) control in the project and applies to all ImagXpress control windows. This enables a user to retain a consistent palette across multiple displayed images. When ManagePalette is False, each control window retains its own palette.
Each ImagXpress control can display only one image at a time. Sometimes it is necessary to display multiple views of the same image. A typical use would be to display a "before" and "after" view of an image with some image rendering options changed.
To view the same image using multiple ImagXpress controls, load the image into the first control and assign its ViewImageID to the second control's ViewImageID. Now the two views share the image.
VB Example |
Copy Code
|
---|---|
// This code demonstrates how to view the same image using multiple ImagXpress controls IX10a.FileName = "a.gif" IX10b.ViewImageID = IX10a.ViewImageID |
To display a dialog box with information about the image being displayed, call ShowViewImageInfo method.